package com.lc.user.express.httpserver;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;


import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONObject;

/**
 * Created by Administrator on 2016/4/19.
 */
@HttpInlet(Net.API_USER)
public class GetApiUser extends ZJDBAsyGet<GetApiUser.Info> {
    public String version;//检测的版本号

    public GetApiUser(String version, AsyCallBack<Info> asyCallBack) {
        super(asyCallBack);
        this.version = version;
    }

    @Override
    protected Info parser(JSONObject object) {
        if (object.optInt("message") == 1) {//服务器有最新版本
            Info info = new Info();
            info.web_v = object.optInt("web_v");
            info.url = object.optString("url");
            info.isNew = false;
            return info;
        }else if(object.optInt("message") == 0){//服务器没有最新版本
            Info info = new Info();
            info.isNew = true;
            return info;
        }
        return null;
    }

    public class Info {
        public int web_v;//最新版本号
        public String url;//地址
        public  boolean isNew = true;
    }

}

